<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Formulario de Autenticación</title>
        <link href="./../resources/css/stylesBasic.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>

        <p:dialog id="dialog" header="Iniciar sesión" widgetVar="dlg" draggable="true" closable="false" visible="true" modal="true" showEffect="fade" hideEffect="fade"  resizable="false">  

            <form method="post" action="j_security_check">
                <h:outputLabel  value="Usuario o contraseña incorrecta. Intente de nuevo." rendered="#{param['error'] eq true}" />
                <h:panelGrid columns="2" cellpadding="5" style="font-size: 15px">
                    <h:outputLabel for="j_username" value="Usuario:"/> 
                    <p:inputText id="j_username" autocomplete="false" />
                    <h:outputLabel for="j_password" value="Contraseña:"/> 
                    <p:password id="j_password" autocomplete="false" />
                    <h:commandButton type="submit" value="Entrar"  /> 
                </h:panelGrid>
            </form>

        </p:dialog>


        <script type="text/javascript">
            function handleLoginRequest(xhr, status, args) {
                if (args.validationFailed || !args.loggedIn) {
                    jQuery('#dialog').effect("shake", {times: 3}, 100);
                } else {
                    dlg.hide();
                    jQuery('#loginLink').fadeOut();
                }
            }
        </script>

    </h:body>
</html>